package com.macro.mall.portal.controller;

import com.macro.mall.common.api.CommonResult;
import com.macro.mall.portal.service.WxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
@Api(tags = "WxController", description = "微信")
@RequestMapping("/wx")
public class WxController {
    @Autowired
    private WxService wxService;
    @ApiOperation("获取token")
    @GetMapping("/accessToken")
    @ResponseBody
    public CommonResult<String> accessToken(){
        String s = wxService.accessToken();
        System.out.println(s);
        return CommonResult.success(s);
    }
    @ApiOperation("获取直播间")
    @PostMapping("/getliveinfo")
    @ResponseBody
    public CommonResult<String> getLiveInfo(@RequestParam Integer start,
                                            @RequestParam Integer limit){
        return CommonResult.success(wxService.getLiveInfo(start,limit));
    }
    @ApiOperation("获取图片")
    @PostMapping("/getWxAcodeunLimit")
    @ResponseBody
    public CommonResult<String> getWxAcodeunLimit(@RequestParam String scene,
                                            @RequestParam String page){
        return CommonResult.success(wxService.getWxAcodeunLimit(scene,page));
    }
}
